package ru.st.selenium;

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;

public class FindFilmTest extends ru.st.selenium.pages.TestBase {

	@Test
	  public void LoginTest() throws Exception {
		driver.get(baseUrl + "/php4dvd/");
	    
		WebElement usernameField = driver.findElement(By.id("username"));
	    usernameField.clear();
	    usernameField.sendKeys("admin");
	    
	    WebElement passwordField = driver.findElement(By.name("password"));
	    passwordField.clear();
	    passwordField.sendKeys("admin");
	    
	    driver.findElement(By.name("submit")).click();
	   }
	
	@Test
	public void testFind() throws Exception {
		driver.get(baseUrl + "/php4dvd/");
		WebElement searchField = driver.findElement(By.xpath("//input[@id=\"q\"]"));
		searchField.clear();
		searchField.sendKeys("AnotherFilm"+Keys.RETURN);
		driver.findElement(By.xpath("//div[.=\"AnotherFilm\"]"));
	}
	
}
